<template>
  <biz-wrap-simple>
    <div class="login-main">
      <div class="brand-info">
        <div style="color: #000; font-size: 25px; font-weight: 800">
          欢迎使用
        </div>
        <img
          :src="getAsset({ url: 'common/gd-accbuild-logo.png' })"
          object-fit="contain"
        />
        <div class="brand-info__intro">
          优速搭(gd-accbuild),一款支持高代码、低代码、零代码混合编程的多端适配的全栈开发框架。
        </div>
      </div>
      <!-- <div
        style="
          margin-top: 40px;
          margin-bottom: 20px;
          font-size: 12px;
          color: red;
        "
      >
        私有UniCloud将项目部署在您个人账号的空间资源中，资源计费都按您个人账号统计；公有UniCloud将项目部署在优速搭账号的空间资源中，资源计费统一在优速搭账号统计。
      </div> -->
      <div style="margin-bottom: 10px">
        <!-- <el-switch
          v-model="isDeployPrivate"
          size="large"
          inline-prompt
          style="--el-switch-on-color: #13ce66; --el-switch-off-color: orange"
          active-text="私有部署"
          inactive-text="公有部署"
        /> -->
        <!-- 、、TODO:FIXME: 登录时不用区分选择私有还是公有，统一默认公有，获取公有token；具体选择项目时，如果是私有项目，则弹出再次输入unicloud账号密码，获取私有token，替换刚才的公有token -->
      </div>
      <el-button
        color="#626aef"
        type="primary"
        @click="loginInOAth2"
        style="margin-top: 40px"
        >DCloud账号登录
      </el-button>
    </div>
  </biz-wrap-simple>
</template>

<script setup>
import { ref, reactive, nextTick } from "vue";
import {
  isSuccessReqBackend,
  getErrorMsgReqBackend,
  getBackendData,
  getAsset,
} from "@/config/utils";
import { globalConfig } from "@uni_modules/gd-accbuild-core/config";
import { useStore } from "@gd-accbuild-core/store/hackVueStore";
const _store = useStore();
const loginInOAth2 = () => {
  let curPageInfo = _store.state.permission.pages.find(
    (page) => page.uiOptions.pageTypeFlag === "Home"
  );
  window.location.href = `https://account.dcloud.net.cn/oauth2/webAuthorize?client_id=${
    globalConfig.OAUTH_INFO["client_id"]
  }&redirect_uri=${encodeURIComponent(
    `${location.origin}${globalConfig.BASE_ROUTER_PREFIX_PATH}${
      globalConfig.ROUTER_MODE === "hash" ? "/#" : ""
    }${curPageInfo?.targetResourceUrl ?? '/pages/home/index'}`
  )}&response_type=code`;
};
const clearLoginToken = () => {
  uni.removeStorageSync("uni_id_token");
  uni.removeStorageSync("uni_id_token_expired");
};
//clearLoginToken();
</script>

<style lang="scss" scoped>
.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  //justify-content: center;
  width: 100vw;
  height: 100vh;
  background-color: #eee;
}
.brand-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 100px 80px 0 80px;
  color: #fff;
  width: 650px;
  > img {
    width: 60%;
  }
}

.brand-info__intro {
  margin: 10px 0;
  font-size: 15px;
  line-height: 1.58;
  opacity: 0.6;
  color: #000;
  font-weight: 550;
}

.login-btn-submit {
  //width: 100%;
  text-align: center;
}
</style>
